﻿@namespace SwashbucklerDiary.Components
@inherits CardListComponentBase<TagModel>

<div class="card-list-wrap">
    <div class="card-list-main">
        <CascadingValue Value="this"
                        IsFixed="true">
            <Virtualize Items="Value"
                        ItemSize="60"
                        Context="item">
                <TagCard @key="item.Id"
                         Value="item">
                </TagCard>
            </Virtualize>
        </CascadingValue>
    </div>
    @if (Value.Any())
    {
        <MultiDisplay Tablet="true">
            <DesktopContent>
                <div class="card-list-assist-info">
                    <TagStatisticsCard Tags="Value"
                                       Diaries="Diaries">
                    </TagStatisticsCard>
                </div>
            </DesktopContent>
        </MultiDisplay>
    }
</div>

<EmptyContent Show="!Value.Any()"
              Text="@(I18n.T("Tag.NoTag"))">
</EmptyContent>

<InputDialog @bind-Value="ShowRename"
             Text="@(SelectedTag.Name)"
             Title="@(I18n.T("Tag.Rename"))"
             Placeholder="@(I18n.T("Tag.Placeholder"))"
             OnOK="ConfirmRename">
</InputDialog>

<DeleteDialog @bind-Value="ShowDelete"
              Title="@(I18n.T("Tag.Delete.Title"))"
              Content="@(I18n.T("Tag.Delete.Content"))"
              OnOK="ConfirmDelete">
</DeleteDialog>

<ExportDialog @bind-Value="ShowExport"
              Diaries="ExportDiaries">
</ExportDialog>

<RadioDialog @bind-ItemValue="SortItem"
             Value="ShowSort"
             ValueChanged="ShowSortChanged"
             Title="@(I18n.T("Share.Sort"))"
             TItemValue="string"
             Items="SortItems">
</RadioDialog>
